<?php
/*code here*/
/* Redirect user if they already logged */
if(Auth::hasAuth('current_user')){
    //$this->view->current_user = Auth::getAuth('current_user');

}
else{
    header('location: /');
}

    $auth = Auth::getAuth('current_user');
    $user_level_id = $auth['user_level_id'];
        // Allow User View
        functions::redirection_user($user_level_id);
/*code here(end)*/


$search = new Search();

if(isset($_GET['form_id'])){
	$id = $_GET['id'];
	if($id!=0){
		$result = functions::getReports("WHERE title LIKE '%" . $search_value ."%' AND company_id={$db->escape($auth['company_id'])} AND id = '". $id ."'");
		$countReport = count($result);
		if($countReport==0){
			header("location:/user_view/home");
		}
	}
	// $id = $_GET['form_id'];
	// $obj = array("condition"=>" AND w.id = ". $id ." ");
	// $obj = json_decode(json_encode($obj),true);
	// $result = $search->getForms("",0,$obj);
	// $countForm = count(json_decode(setAdminViewer($result),true));
	// if($countForm==0){
	// 	header("location:/user_view/home");
	// }
}

$this->setLayout();